package com.bestom.bluetoothlock.views;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.bestom.bluetoothlock.R;


public class InputDialog extends Dialog {
    private TextView cancel;
    private View customView;
    private EditText et_content;
    private Context mContext;
    /* access modifiers changed from: private */
    public OnConfirmClickListener mOnConfirmClickListener;
    private TextView sure;
    private TextView tv_title;

    public interface OnConfirmClickListener {
        void onConfirmClick(View view);
    }

    public InputDialog(Context context) {
        super(context, R.style.NoTranslucentDialog);
        this.mContext = context;
        this.customView = LayoutInflater.from(context).inflate(R.layout.dialog_input, (ViewGroup) null);
    }

    /* access modifiers changed from: protected */
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(this.customView);
        initView();
    }

    private void initView() {
        this.tv_title = (TextView) this.customView.findViewById(R.id.tv_title);
        this.sure = (TextView) this.customView.findViewById(R.id.tv_ok);
        this.cancel = (TextView) this.customView.findViewById(R.id.tv_cancel);
        this.et_content = (EditText) this.customView.findViewById(R.id.et_content);
        this.cancel.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                InputDialog.this.dismiss();
            }
        });
        this.sure.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                InputDialog.this.mOnConfirmClickListener.onConfirmClick(view);
                InputDialog.this.dismiss();
            }
        });
    }

    public void setTitle(String str) {
        this.tv_title.setText(str);
    }

    public String getContent() {
        String obj = this.et_content.getText().toString();
        if (!TextUtils.isEmpty(obj)) {
            return obj;
        }
        return null;
    }

    public void setOnConfirmClickListener(OnConfirmClickListener onConfirmClickListener) {
        this.mOnConfirmClickListener = onConfirmClickListener;
    }
}
